package com.lianxd.easybuy.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Arrays;
import java.util.Map;


@WebServlet(value = {"/users/index1"})
public class zuoye1 extends HttpServlet {


    @Override
    protected void doPost(
            HttpServletRequest request,
            HttpServletResponse response)
            throws ServletException, IOException
    {
        request.setCharacterEncoding("UTF-8");
        response.setContentType("text/html;charset=UTF-8");

        String name = request.getParameter("name");
        System.out.println("姓名：" + name);

        String username = request.getParameter("username");
        System.out.println("用户名：" + username);

        String pwd = request.getParameter("pwd");
        System.out.println("密码：" + pwd );

        String repwd = request.getParameter("repwd");
        System.out.println("确认密码：" + repwd);

        String email = request.getParameter("email");
        System.out.println("电子邮件：" + email);

        String sex = request.getParameter("sex");
        System.out.println("性别：" + sex);

        String[] hobby = request.getParameterValues("hobby");
        System.out.println("业余爱好：" + Arrays.toString(hobby));

        String birthday = request.getParameter("birthday");
        System.out.println("出生日期：" + birthday);

        Map<String, String[]> parameterMap = request.getParameterMap();
        for (String p:parameterMap.keySet()){
            String[] strings = parameterMap.get(p);
            System.out.println(p+Arrays.toString(strings));

        }


    }
}
